n, m, k = map(int, input().split())

# index form 1
a = [[0] * (m + 1) for i in range(n + 1)]
sum = [[0] * (m + 1) for i in range(n + 1)]

for i in range(1, n + 1):
    a[i] = [0] + list(map(int, input().split()))


#预处理二维前缀和
for i in range(1, n + 1):
    for j in range(1, m + 1):
        sum[i][j] = sum[i-1][j] + sum[i][j - 1] - sum[i-1][j-1] + a[i][j]


def get_sum(sum, x1, y1, x2, y2):
    return sum[x2][y2] - sum[x1-1][y2] - sum[x2][y1-1] + sum[x1-1][y1-1]

#记录 和 不超过K的矩阵数
ans = 0
for x1 in range(1, n + 1):
    for y1 in range(1, m + 1):

        for x2 in range(x1, n + 1):
            for y2 in range(y1, m + 1):
                if get_sum(sum, x1, y1, x2, y2) <= k:
                    ans += 1

print(ans)
